﻿<UserControl x:Class="Ewav.FrequencyControl"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:GadgetSelector="clr-namespace:Ewav.ContextMenu;assembly=Ewav.ContextMenu.Menu"
	xmlns:Common="clr-namespace:CommonLibrary;assembly=CommonLibrary"
	mc:Ignorable="d"
	d:DesignHeight="600" d:DesignWidth="400"
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
	DataContext="{Binding Source={StaticResource Locator}, Path=FrequencyViewModel}" >

	<UserControl.Resources>

		<Style x:Key="HeaderCell" TargetType="Rectangle">
			<Setter Property="Stroke" Value="#FFC4C4C4"/>
			<Setter Property="StrokeThickness" Value="0.4"/>
			<Setter Property="Fill" Value="#FFE5F2D9"/>
			<Setter Property="VerticalAlignment" Value="Top"/>
			<Setter Property="HorizontalAlignment" Value="Stretch"/>
		</Style>
		<Style x:Key="TextBlockStyle1" TargetType="TextBlock">
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="FontFamily" Value="Segoe UI"/>
			<Setter Property="FontSize" Value="12"/>
			<Setter Property="Margin" Value="4"/>
		</Style>

	</UserControl.Resources>
	
	<Grid x:Name="LayoutRoot" Background="White" MouseRightButtonDown="LayoutRoot_MouseRightButtonDown" 
		  MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown" Margin="0,0,-115,0">
		
	  


		<Grid x:Name="GadgetWindow" Background="White" MinWidth="400" >
			<Grid.RowDefinitions>
        		<RowDefinition Height="50"/>
        		<RowDefinition/>
        	</Grid.RowDefinitions>
        	<Grid.ColumnDefinitions>
        		<ColumnDefinition Width="Auto"/>
        		<ColumnDefinition/>
        	</Grid.ColumnDefinitions>

			<Rectangle x:Name="GWindow" Style="{StaticResource GWindow}" Grid.RowSpan="2" Stroke="{StaticResource WindowBrush}" StrokeThickness="4" Margin="0,0,-12,0" Grid.ColumnSpan="2" />
			<StackPanel d:LayoutOverrides="VerticalAlignment, GridBox" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="13,11,0,0">
				<TextBlock x:Name="GName" TextWrapping="Wrap" Text="Frequency" VerticalAlignment="Top" Margin="0,0,26,0" Height="Auto" HorizontalAlignment="Left" Foreground="#FF2B4360" FontSize="21.333"/>

				<Rectangle x:Name="GHeader" VerticalAlignment="Top" Height="4" Margin="0,2,0,0" StrokeThickness="0" Fill="#FF00B050" />	
			</StackPanel>
			<StackPanel HorizontalAlignment="Right" Margin="180,9,1,0" Orientation="Horizontal" VerticalAlignment="Top" Grid.Column="1">
				<Button x:Name="FilterButton" Content="" Template="{StaticResource FilterButton}" Cursor="Hand" Click="FilterButton_Click"  Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="HeaderButton" Content="" Template="{StaticResource HeaderButton}" Cursor="Hand" Click="HeaderButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="ResizeButton" Content="" Template="{StaticResource resizebtn}" Cursor="Hand" Click="ResizeButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
				<Button x:Name="CloseButton" Content="" Template="{StaticResource CloseButton}" Cursor="Hand" Click="CloseButton_Click" Width="24" Height="24" >
					<Button.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</Button.Effect>
				</Button>
			</StackPanel>
			<Grid x:Name="GadgetContentGrid" Grid.Row="1" Margin="0,5,0,0" MinHeight="30" Grid.ColumnSpan="2">
				<toolkit:Expander Margin="0,-45,121,10" VerticalAlignment="Top" 
				ExpandDirection="Down" IsExpanded="True" Style="{StaticResource ExpanderStyle1}" Canvas.ZIndex="999" HorizontalAlignment="Right" Width="188" x:Name="gadgetExpander">
					<toolkit:Expander.Effect>
						<DropShadowEffect Color="#FFB0B0B0" ShadowDepth="1"/>
					</toolkit:Expander.Effect>

					<toolkit:Expander.Header>
						<TextBlock Text="Edit Properties" Cursor="Hand" Foreground="White"/>
					</toolkit:Expander.Header>
                    <Grid Background="#FF5C53AC" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,-2,1,0">
						<StackPanel VerticalAlignment="Top" HorizontalAlignment="Center" Width="175" Margin="2,7,2,0">
							<TextBlock x:Name="tblockMainVariable" TextAlignment="Center" Text="Field:" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,0,0,0" Foreground="White"  />
							<ComboBox x:Name="cbxField" Width="160" SelectedIndex="0" Height="25" Margin="5,3,0,0" VerticalAlignment="Top" HorizontalContentAlignment="Left" HorizontalAlignment="Left" UseLayoutRounding="False" />

                            <!--<toolkit:WrapPanel x:Name="wrapPanel" Height="100" Width="200"  FlowDirection="LeftToRight"
                                                  ></toolkit:WrapPanel>-->
                                <toolkit:Expander x:Name="AdvancedOptions" Margin="0,10" ExpandDirection="Down" MouseLeftButtonDown="LayoutRoot_MouseRightButtonDown" Style="{StaticResource ExpanderStyle}" Foreground="White">
								<toolkit:Expander.Header>
									<TextBlock Text="Advanced Options" Cursor="Hand" Foreground="White"/>
								</toolkit:Expander.Header>
								<StackPanel Orientation="Vertical" Margin="2" MinHeight="230" VerticalAlignment="Top">
									<TextBlock x:Name="tblockWeightVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Weight:" Margin="0,5,0,1" Foreground="White"  />
									<ComboBox x:Name="cbxFieldWeight" Width="160" HorizontalAlignment="Left" SelectedIndex="0" Margin="0,3,0,-20" VerticalAlignment="Bottom" />
									<TextBlock x:Name="tblockStrataVariable" HorizontalAlignment="Left" TextAlignment="Center" Text="Stratify by:" Margin="0,0,0,-40"  VerticalAlignment="Bottom" Foreground="White" />
									<ComboBox x:Name="cbxFieldStrata" Width="160" HorizontalAlignment="Left" SelectedIndex="0" Margin="0,43,0,-64" VerticalAlignment="Top" />
									<!--<CheckBox x:Name="checkboxAllValues" Margin="0,0,0," Content="Display all list values"  HorizontalAlignment="Left" IsEnabled="false" VerticalAlignment="Bottom" Visibility="Collapsed"/>
									<CheckBox x:Name="checkboxCommentLegalLabels" Margin="0,0,0,-104" Content="Display list labels"  HorizontalAlignment="Left" IsEnabled="false" VerticalAlignment="Bottom"  Visibility="Collapsed"/>-->
									<CheckBox x:Name="checkboxSortHighLow" Margin="-6,0,0,-93" Content="Sort high to low" HorizontalAlignment="Left" VerticalAlignment="Bottom" Padding="-1,0,0,0" Foreground="White" FontSize="13.333" />
									<CheckBox x:Name="checkboxConfLimits" Margin="-6,0,0,-116" Content="Confidence limits" HorizontalAlignment="Left" IsChecked="True" VerticalAlignment="Bottom" Padding="-1,0,0,0" Foreground="White" FontSize="13.333" />
									<CheckBox x:Name="checkboxCumPercent" Margin="-6,0,0,-142" Content="Cumulative percentage" HorizontalAlignment="Left" IsChecked="True" VerticalAlignment="Bottom" Padding="-1,0,0,0" Foreground="White" FontSize="13.333" />
									<CheckBox x:Name="checkboxIncludeMissing" Margin="-6,0,0,-165" Content="Include missing values" HorizontalAlignment="Left" IsChecked="False" VerticalAlignment="Bottom" Padding="-1,0,0,0" Foreground="White" FontSize="13.333" />
									<TextBlock x:Name="tblockMaxRowsLabel" HorizontalAlignment="Left" Text="Max rows:" Margin="0,0,0,-186"  VerticalAlignment="Bottom" TextWrapping="Wrap" Width="69" Foreground="White"  />
									<TextBox x:Name="txtMaxRows" Width="40" HorizontalAlignment="Left" Text="200" Margin="75,0,0,-192"  VerticalAlignment="Bottom" TextChanged="txtMaxRows_TextChanged" />
									<Button Content="" Margin="125,0,0,-189" VerticalAlignment="Bottom" Style="{StaticResource UpdateMaxRows}" Width="23" Height="23" Cursor="Hand" HorizontalAlignment="Left" ToolTipService.ToolTip="Update rows displayed" Click="UpdateButton_Click"/>
								</StackPanel>
							</toolkit:Expander>
						</StackPanel>

					</Grid>
				</toolkit:Expander>

				<StackPanel x:Name="spContent" Orientation="Vertical" Margin="10,6,1,10" Visibility="Collapsed">
                    <!--<Grid>
							<Common:WaitCursor x:Name="waitCursor" Width="25" Height="25" Visibility="Collapsed"  HorizontalAlignment="Right" VerticalAlignment="Top"/>
						</Grid>-->  
					<TextBlock x:Name="txtGadgetDescription" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="3,3,0,6" Visibility="Visible" d:LayoutOverrides="HorizontalMargin" MaxWidth="650" Padding="0,0,10,0" />
                    <StackPanel x:Name="pnlStatus" Height="58" MaxHeight="40" Width="Auto" Background="#FFf8d7e2" VerticalAlignment="Top" Margin="0,5" Visibility="Collapsed">
                        <StackPanel x:Name="pnlStatusTop" Height="2" Width="Auto" Background="#FFe4658e"/>
                        <Image x:Name="ErrorIcon" Source="../../Images/error.png" Width="18" Height="18" HorizontalAlignment="Left" Margin="5,1,5,0" VerticalAlignment="Center"/>
						<TextBlock x:Name="txtStatus" Text="Error: Exception occurred." TextWrapping="Wrap" Margin="30,-15,5,5" HorizontalAlignment="Left" FontWeight="Bold" VerticalAlignment="Center"/>
					</StackPanel>
					<StackPanel x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top">                     
						<Grid x:Name="grdFreq" Width="Auto" HorizontalAlignment="Center" Margin="0,0,0,0" Visibility="Collapsed">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="100"/>
							</Grid.ColumnDefinitions>
						 </Grid>
					</StackPanel>
				</StackPanel>
				<Grid x:Name="waitCursor" Background="#36C4C4C4" Height="Auto" Visibility="Collapsed">
					<toolkit:BusyIndicator x:Name="BusyIndicator" IsBusy="True" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="100" />			
				</Grid>
			</Grid>
		</Grid>
		<!--</groupBox:GroupBox>-->
		<!--<Image x:Name="imgClose" Source="Images\x.png" HorizontalAlignment="Right" VerticalAlignment="Top"/>-->
	</Grid>
</UserControl>
